package cn.iocoder.yudao.module.peizhen.dal.mysql.project;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.peizhen.controller.app.project.vo.AppProjectPageReqVO;
import cn.iocoder.yudao.module.peizhen.dal.dataobject.project.ProjectDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.peizhen.controller.admin.project.vo.*;

/**
 * 服务项目 Mapper
 *
 * @author duanxinli
 */
@Mapper
public interface ProjectMapper extends BaseMapperX<ProjectDO> {

    default PageResult<ProjectDO> selectPage(ProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProjectDO>()
                .likeIfPresent(ProjectDO::getName, reqVO.getName())
                .eqIfPresent(ProjectDO::getShortDescription, reqVO.getShortDescription())
                .eqIfPresent(ProjectDO::getIcon, reqVO.getIcon())
                .eqIfPresent(ProjectDO::getCover, reqVO.getCover())
                .eqIfPresent(ProjectDO::getRecommend, reqVO.getRecommend())
                .eqIfPresent(ProjectDO::getSort, reqVO.getSort())
                .betweenIfPresent(ProjectDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(ProjectDO::getSort));
    }



    default List<ProjectDO> selectList(AppProjectPageReqVO reqVO) {
        return  this.selectList(new LambdaQueryWrapperX<ProjectDO>()
                .likeIfPresent(ProjectDO::getName, reqVO.getName())
                .orderByAsc(ProjectDO::getSort));
    }



}